package HuaweiOD;

import java.util.*;

public class 无重复字符的最长子串 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        System.out.println(lengthOfLongestSubstring(str));
    }

    public static int lengthOfLongestSubstring(String s) {
        if (s.length() == 0) return 0;

        HashMap<Character, Integer> map = new HashMap<>();
        int l = 0, max = 0;
        for (int i = 0; i < s.length(); i++) {
            Character c = s.charAt(i);
            if (map.containsKey(c)){
                l = Math.max(l, (map.get(c) + 1));
            }
            map.put(c, i);
            max = Math.max(max, i - l + 1);
        }

        return max;
    }
}
